package com.redis.message;

import java.io.Serializable;

import javax.annotation.Resource;

import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

@Component
public class SendMessage {

	@Resource
	private RedisTemplate<Serializable, Object> redisTemplate;

	/**
	 * 发送消息
	 * 
	 * @param channel
	 * @param message
	 */
	public void sendMessage(String channel, Serializable message) {
		redisTemplate.convertAndSend(channel, message);
	}

}
